/*
 * Interruptverwaltung.h
 *
 *  Created on: 03.05.2011
 *      Author: Jasper
 */

#ifndef INTERRUPTVERWALTUNG_H_
#define INTERRUPTVERWALTUNG_H_

#include "constants.h"
#include <sys/neutrino.h>
#include <stdlib.h>
#include "HWaccess.h"

#ifdef SIMULATION
#include <ioaccess.h>
#endif

#define LISTSIZE 12


class Interruptverwaltung
{

public:
    int addListener(int channelID, pid_t pid, int pin, char messageCode, int messageContent);
    int removeListener(int channelID, pid_t pid, int pin);

private:
    struct listItem
    {
        struct listItem* next;
        int channelID;
        int connectionID;
        int pin;
        char messageCode;
        int messageContent;
        pid_t pid;
    };

    listItem (* list)[LISTSIZE];
    int lastValB;
    int lastValC;

    int init();
    Interruptverwaltung();
    virtual ~Interruptverwaltung();

};

#endif /* INTERRUPTVERWALTUNG_H_ */
